require("GameCode/TankCmp")

-- local GameObject = UnityEngine.GameObject
local LuaHelper = LuaFramework.LuaHelper
local testCube = nil
local testView
local isImgActivate = false
local ImageGO

--主入口函数。从这里开始lua逻辑
function Main()					
	-- resMgr = LuaHelper.GetResManager()
	-- -- resMgr:LoadPrefab('test', {'TestCube'}, OnLoadFinish)
	-- resMgr:LoadPrefab('test', {'TestView'}, OnLoadFinish)
end

-- function OnLoadFinish(objs)
-- 	print('LoadFinish')
-- 	testView = GameObject.Instantiate(objs[0])
-- 	local uiRoot = GameObject.FindGameObjectWithTag('UIRoot')
-- 	-- local uiRoot = GameObject.Find('Canvas')
-- 	testView.transform:SetParent(uiRoot.transform)
-- 	testView.transform.localScale = Vector3.one
-- 	testView.transform.localPosition = Vector3.zero

-- 	-- 事件处理
-- 	-- local btn = GameObject.Find('TestBtn')
-- 	-- ImageGO = GameObject.Find('Image')
-- 	local btn = testView.transform:Find('TestBtn').gameObject
-- 	ImageGO = testView.transform:Find('Image').gameObject
-- 	ImageGO:SetActive(isImgActivate)
-- 	UIEvent.AddButtonClick(btn, OnBtnClick)

-- 	-- testCube = GameObject.Instantiate(objs[0])

-- 	-- local tankCmp = LuaComponent.Add(testCube, TankCmp)
-- 	-- tankCmp.name = 'testCube'
-- end

-- function OnBtnClick()
-- 	print('OnBtnClick()')
-- 	isImgActivate = not isImgActivate
-- 	-- testView.transform:FindChild('Image'):SetActive(isImgActivate)
-- 	ImageGO:SetActive(isImgActivate)	
-- end

--场景切换通知
function OnLevelWasLoaded(level)
	collectgarbage("collect")
	Time.timeSinceLevelLoad = 0
end

function OnApplicationQuit()
end